﻿/*------------------------------------------------
// File Description: Order DataBase Entity
// Author:			 汪亮
// Create Time:		 2020-02-26 02:33:23
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IOA.MES.DataAccess.Entity
{
    /// <summary>
    /// 订单表
    /// </summary>
    [Table(nameof(Order))]
    public class Order : BaseEntity
    {
        private string _customerCode = string.Empty;
        private string _customerName = string.Empty;
        private string _description = string.Empty;
        private string _remark = string.Empty;
        private string _contractNo = string.Empty;
        private string _innerOrderNo = string.Empty;
        private string _standardLevel = string.Empty;


        #region Public Property

        ///<Summary>
        /// 内部订单号
        ///</Summary>
        public string InnerOrderNo
        {
            get { return string.IsNullOrWhiteSpace(_innerOrderNo) ? string.Empty : _innerOrderNo; }
            set { _innerOrderNo = value; }
        }

        ///<Summary>
        /// 下单时间
        ///</Summary>
        public DateTime OrderTime { get; set; }

        ///<Summary>
        /// 客户代码
        ///</Summary>
        public string CustomerCode
        {
            get { return string.IsNullOrWhiteSpace(_customerCode) ? string.Empty : _customerCode; }
            set { _customerCode = value; }
        }

        ///<Summary>
        /// 客户名称
        ///</Summary>
        public string CustomerName
        {
            get { return string.IsNullOrWhiteSpace(_customerName) ? string.Empty : _customerName; }
            set { _customerName = value; }
        }

        ///<Summary>
        /// 产品数量
        ///</Summary>
        public decimal ProductNum { get; set; }

        ///<Summary>
        /// 订单描述
        ///</Summary>
        public string Description
        {
            get { return string.IsNullOrWhiteSpace(_description) ? string.Empty : _description; }
            set { _description = value; }
        }

        ///<Summary>
        /// 备注
        ///</Summary>
        public string Remark
        {
            get { return string.IsNullOrWhiteSpace(_remark) ? string.Empty : _remark; }
            set { _remark = value; }
        }

        ///<Summary>
        /// 订单状态
        ///</Summary>
        public Enum.OrderStatus Status { get; set; }

        ///<Summary>
        /// 已分解
        ///</Summary>
        public bool Breaked { get; set; } = false;

        /// <summary>
        /// 预计发货日期
        /// </summary>
        public DateTime? ExpectedShippingDate { get; set; }

        /// <summary>
        /// 合同号
        /// </summary>
        public string ContractNo
        {
            get { return string.IsNullOrWhiteSpace(_contractNo) ? string.Empty : _contractNo; }
            set { _contractNo = value; }
        }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? ReviewTime { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        ///<Summary>
        /// 执行标准
        ///</Summary>
        public string StandardLevel
        {
            get { return string.IsNullOrWhiteSpace(_standardLevel) ? string.Empty : _standardLevel; }
            set { _standardLevel = value; }
        }
        #endregion
    }

    public partial class MESContext
    {
        /// <summary>
        /// 订单表
        /// </summary>
        public virtual DbSet<Order> Orders { get; set; }
    }
}